home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_1
/
cpdist
/
mklnk.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-12
|
1KB
|
61 lines
/*
* MKLNK.C
*
* (c)Copyright 1993 by Tobias Ferber, All Rights Reserved.
*/
#include <stdio.h>
#include <stdlib.h>
#define LINKFILE "turboc.$ln"
static char rcs_id[]= "$VER: $Id: mklnk.c 1.2 93/08/27 00:04:43 tf Exp $\0"
"(compiled " __DATE__ ", " __TIME__ " MS-DOS)";
main(int argc, char **argv)
{
int errorlevel= 0;
FILE *fp;
if(argc<2)
{ if( fp= fopen(LINKFILE,"r") )
{ fclose(fp);
if( errorlevel= remove(LINKFILE) )
{ fprintf(stderr,"MKLNK.EXE: Can't remove \"%s\".\n",LINKFILE);
perror("MKLNK.EXE");
}
else fprintf(stderr,"MKLNK.EXE: \"%s\" removed.\n",LINKFILE);
}
}
else if(argc==2 && argv[1][0]=='?' || argv[1][0]=='.')
{ fprintf(stderr,"%s\n"
"(c)Copyright 1993 by Tobias Ferber, All Rights Reserved\n"
"MKLNK objfiles libfiles", &rcs_id[6]);
}
else
{
if( fp= fopen(LINKFILE,"a") )
{
while(--argc > 0)
{
char *s= *++argv;
if(argc>=2)
{ fprintf(fp,"%s+\n",s);
if(argc==2 && argv[1][0]=='+')
--argc;
}
else if(argc==1) fprintf(fp,"%s\n",s);
}
fclose(fp);
}
else
{
fprintf(stderr,"Can't append data to ´%s'.\n",LINKFILE);
errorlevel= 10;
}
}
exit(errorlevel);
}